package zhongbo.java.air.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import zhongbo.java.air.config.RedisListenerConfig;

@Component
@Slf4j
//发送消息到redis
public class RedisLogChaneIPublisher {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    public void publish(String channel, String message) {
        log.info("从通道发布航迹原始数据消息 '{}': {}", channel, message);
        stringRedisTemplate.convertAndSend(channel, message);
    }
}
